<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/favicon.ico" >
<LINK rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/Public/Assets/Hui/lib/html5.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/respond.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/PIE_IE678.js"></script>
<![endif]-->
<link href="/Public/Assets/Hui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Hui/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Hui/lib/validator/jquery.validator.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Hui/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Miniweb/lib/datepicker/dist/datepicker.min.css" rel="stylesheet" type="text/css" />
<link href="/Public/Assets/Hui/css/pagecss.css?v=1.0.0" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="/Public/Assets/Hui/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
<link rel="stylesheet" type="text/css" href="/Public/Assets/Miniweb/lib/treeTable/treeTable.css" />
<link href="/Public/Assets/Hui/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="/Public/Assets/Hui/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>Administator管理后台</title>


</head>
<body>

	<nav class="breadcrumb">
		<i class="Hui-iconfont"></i>
		 首页 <span class="c-gray en">&gt;</span>
		 应用管理 <span class="c-gray en">&gt;</span>  
		应用分类管理 
		<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont"></i></a>
	</nav>
	<div class="pd-20">
		<div class="cl pd-5 bg-1 bk-gray"> 
			<div class="btn-group l mr-20">
				<form action="<?php echo u('catsadmin/index');?>" method="get" id="changeForm">
				<select class="input-text changeG" name="group_id" style="width:auto;">
					<?php if(is_array($groups)): foreach($groups as $key=>$vo): ?><option value="<?php echo ($vo["group_id"]); ?>" <?php if(($_GET['group_id']) == $vo['group_id']): ?>selected<?php endif; ?>><?php echo ($vo["group_name"]); ?></option><?php endforeach; endif; ?>
				</select>
				</form>
			</div>
			<span class="l">
				<a href="javascript:;" onclick="open_iframe_dialog('/material/catsadmin/indexgroup.html','分组管理',['850px','550px'],1)" class="btn btn-primary radius"><i class="Hui-iconfont"></i> 分类分组管理</a>
			</span> 
			<span class="r"></span>
		</div>
		<table class="table">
			<tr>
				<td width="200" class="va-t">
					<div class="mb-10">
						操作：
						<div class="btn-group">
							<a <?php if($_SESSION["cur_appcat_action"] == "add"): ?>_<?php endif; ?>href="<?php echo U('Catsadmin/index','action=add');?>" class="btn btn-default <?php if($_SESSION["cur_appcat_action"] == "add"): ?>btn-primary<?php endif; ?> radius">添加</a>
						  	<a <?php if($_SESSION["cur_appcat_action"] == "edit"): ?>_<?php endif; ?>href="<?php echo U('Catsadmin/index','action=edit');?>" class="btn btn-default <?php if($_SESSION["cur_appcat_action"] == "edit"): ?>btn-primary<?php endif; ?> radius">编辑</a>
						  	<a <?php if($_SESSION["cur_appcat_action"] == "del"): ?>_<?php endif; ?>href="<?php echo U('Catsadmin/index','action=del');?>" class="btn btn-default <?php if($_SESSION["cur_appcat_action"] == "del"): ?>btn-primary<?php endif; ?> radius">删除</a>
						</div>
					</div>
					<ul id="treeDemo" class="ztree"></ul>
				</td>
				<td class="va-t"><IFRAME ID="testIframe" Name="testIframe" FRAMEBORDER=0 SCROLLING=AUTO width=100%  height=390px SRC="<?php echo u('Catsadmin/edit');?>"></IFRAME></td>
			</tr>
		</table>
		
	</div>


<script type="text/javascript" src="/Public/Assets/Hui/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/validator/jquery.validator.js"></script> 
<script type="text/javascript" src="/Public/Assets/Hui/lib/validator/local/zh_CN.js"></script> 
<script type="text/javascript" src="/Public/Sea/modules/layer/2.1/layer/layer.js"></script>
<script type="text/javascript" src="/Public/Assets/Miniweb/lib/datepicker/dist/datepicker.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Miniweb/lib/datepicker/i18n/datepicker.zh-CN.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script> 
<script type="text/javascript" src="/Public/Assets/Miniweb/lib/treeTable/treeTable.js"></script>
<script type="text/javascript" src="/Public/Assets/Hui/js/H-ui.js"></script> 
<script type="text/javascript" src="/Public/Assets/Hui/js/H-ui.admin.js"></script> 
<script type="text/javascript" src="/Public/Assets/Hui/lib/icheck/jquery.icheck.min.js"></script>
<script type="text/javascript" src="/Public/Assets/Miniweb/mini-admin.js"></script> 



<script type="text/javascript">
$('.changeG').change(function(){
	$('#changeForm').submit();
});
var cur_action = '<?php echo ($_SESSION["cur_appcat_action"]); ?>';

var setting = {
	view: {
		dblClickExpand: false,
		showLine: false,
		selectedMulti: false
	},
	data: {
		simpleData: {
			enable:true,
			idKey: "id",
			pIdKey: "pId",
			rootPId: ""
		}
	},
	callback: {
		beforeClick: function(treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("tree");
			if (treeNode.isParent) {
				//zTree.expandNode(treeNode);
				//return false;
			} 
			var url = '/Material/Catsadmin/edit' ;
			if(cur_action == 'add'){
				url = url + '/parentid/'+treeNode.id;
				demoIframe.attr("src",url);
			}
			if(cur_action == 'edit'){
				url = url + '/id/'+treeNode.id;
				demoIframe.attr("src",url);
			}
			if(cur_action == 'del'){
				var asker = layer.confirm('确定删除吗？', function(){
					var ii = layer.msg('数据处理中...', {icon: 16,time: 10000}, function(){
			    	    layer.alert('服务器响应超时', {icon: 7});
			    	});
					$.get('/Material/Catsadmin/del/ids/'+treeNode.id,function(data){
						layer.close(ii);
						//data = JSON.parse(data);  //str 转 json
						if(data.status){
							layer.msg('删除成功', {icon: 1,time:1000},function(){
							    location.reload(); //自动关闭后可做一些刷新页面等操作
							});
						}else{
							layer.msg(data.info, {icon: 2,time:1000});
						}
					},'json');
				});
			}
			return true;
			
		}
	}
};
		
var code;
		
function showCode(str) {
	if (!code) code = $("#code");
	code.empty();
	code.append("<li>"+str+"</li>");
}
		
$(document).ready(function(){
	
});

function shuaxin_nodes(){

	$.post('/Material/catsadmin/ajax_nodes/groupid/<?php echo ($_SESSION['cur_select_group']); ?>',function(res){
		//alert(res[0]);
		var t = $("#treeDemo");
		t = $.fn.zTree.init(t, setting,res );
		demoIframe = $("#testIframe");
		demoIframe.bind("load", loadReady);
		var zTree = $.fn.zTree.getZTreeObj("tree");
		zTree.selectNode(zTree.getNodeByParam("id",'11'));
	});

}
</script>

</body>
</html>